﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace Kamikaze
{
    class gameOver : SceneBase
    {
        Texture2D texturaGameOver;
        
        MouseState mouse, oldMouse;
        AnimatedObject botaoContinue;

        Song song;
       



        public override void start()
        {

            Game1.Self.IsMouseVisible = true;
            texturaGameOver = (Game1.Self.Content.Load<Texture2D>(@"Imagens/GameOver"));

            Kamikaze.AnimatedObject.AnimationStructure animationContinue = new Kamikaze.AnimatedObject.AnimationStructure();
            animationContinue.frameCount = 1;
            animationContinue.frameWidth = 135;
            animationContinue.frameHeight = 37;
            animationContinue.framePerSecond = 1;
           animationContinue.X = 135 * 1;
           animationContinue.Y = 0;




            botaoContinue = new AnimatedObject(Game1.Self.Content.Load<Texture2D>(@"Imagens/continue"), 135, 36);
            botaoContinue.posicao.X = 300;
            botaoContinue.posicao.Y = 300;
            botaoContinue.listaAnimations.Add("continue", animationContinue);

            song = (Game1.Self.Content.Load<Song>(@"Sounds/fail-trombone-03"));
            MediaPlayer.Play(song);
            MediaPlayer.IsRepeating = false;
            
            
        }

        public override void update(GameTime gameTime)
        {
            oldMouse = mouse;
            mouse = Mouse.GetState();

            botaoContinue.calcularRetangulo();
            botaoContinue.Update(gameTime);

            if (botaoContinue.collisionBounds.Contains(mouse.X, mouse.Y))
            {


                botaoContinue.ChangeAnimation("continue");



            }
            else
            {


                botaoContinue.ChangeAnimation("default");
            }



            if (mouse.LeftButton == ButtonState.Pressed && oldMouse != mouse)
            {
                if (botaoContinue.collisionBounds.Contains(mouse.X, mouse.Y))
                {
                    SceneManager.setScene(new level1());
                }
            }

           



        }
       


        public override void draw(SpriteBatch spriteBatch)
        {



            spriteBatch.Draw(texturaGameOver, new Vector2(0, 0), Color.White);
            botaoContinue.Draw(spriteBatch);
        }

        public override void terminate()
        {
            Game1.Self.IsMouseVisible = false;
        }








    }
}
